Skip to content

LMRewardsOperationalMetric metric

Bases: LMOperationalMetric

Reward-phase LM counter base; subclass to add one, don't compile it.

Reads from each bound LM's reward_cumulated_* counters, which the LM populates while Trainer.compute_reward is running.

Example:

program.compile(
    metrics=[
        synalinks.metrics.LMRewardsOperationalMetric(),
    ],
)
Source code in synalinks/src/metrics/lm_metrics.py
@synalinks_export(
    [
        "synalinks.metrics.LMRewardsOperationalMetric",
        "synalinks.LMRewardsOperationalMetric",
    ]
)
class LMRewardsOperationalMetric(LMOperationalMetric):
    """Reward-phase LM counter base; subclass to add one, don't compile it.

    Reads from each bound LM's `reward_cumulated_*` counters, which the
    LM populates while `Trainer.compute_reward` is running.

    Example:

    ```python
    program.compile(
        metrics=[
            synalinks.metrics.LMRewardsOperationalMetric(),
        ],
    )
    ```
    """

    _phase = "reward"